<template>
  <div>
    <el-page-header @back="goBack" content="返回首页"> </el-page-header
    ><el-button size="mini" @click="toLeave">退出</el-button>
    <el-divider></el-divider>
    <el-descriptions title="用户信息">
      <el-descriptions-item label="用户名">{{
        userInfo.userName
      }}</el-descriptions-item>
      <el-descriptions-item label="年龄">{{
        userInfo.age
      }}</el-descriptions-item>

      <el-descriptions-item label="用户昵称">{{
        userInfo.realName
      }}</el-descriptions-item>

      <el-descriptions-item label="地址">{{
        userInfo.address
      }}</el-descriptions-item>
    </el-descriptions>
    <p v-show="userInfo.status == 2">
      <router-link to="/Write">后台</router-link>
    </p>
  </div>
</template>
<script>
import store from "store";
import router from "@/router";
import Cookies from "js-cookie";
export default {
  data() {
    return {
      userInfo: "",
    };
  },
  methods: {
    getUserStore() {
      let myString = store.get("SET_USER_INFO");

      console.log("--------》", myString); //
      this.userInfo = myString;
    },
    goBack() {
      router.push("/");
    },
    toLeave() {
      //store.remove("SET_USER_INFO");
      store.remove("SET_USER_INFO");
      Cookies.remove("expire");
      router.push("/");
    },
  },

  created() {
    this.getUserStore();
  },
};
</script>
